package com.example.remindme.RemindModule.DataCard.ViewHolder


import android.view.View
import android.widget.RadioButton
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.example.remindme.R
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.*

class ViewHolderBlock(val root: View): RecyclerView.ViewHolder(root) {
    val timeTv=root.findViewById<TextView>(R.id.timeTV)
    val timeRadio=root.findViewById<RadioButton>(R.id.timeradio)
    fun bind(data: RecyclerData)
    {
        // 把对应的block与布局结合起来就行
      if(data is Matter)
      {
          val nowDay=Date()
          val date= Date(data.timed)
          if(nowDay<=date)
          {
              timeTv.setTextColor(root.resources.getColor(R.color.future))
          }
          else
              timeTv.setTextColor(root.resources.getColor(R.color.past))
          val format: DateFormat = SimpleDateFormat("yyyy/MM/dd", Locale.getDefault())
          val day=format.format(date)
          timeTv.text=day
          timeRadio.text=data.matter
      }

    }
}